﻿using CxRomos.Core.Domain.Entities;
using FluentNHibernate.Mapping;

namespace CxRomos.Core.Domain.Mappings {
    public class AccountPermissionMap : ClassMap<AccountPermission> {
        public AccountPermissionMap() {
            Table("[dbo].[AccountPermissions]");
            OptimisticLock.Version();
            LazyLoad();

            Id(x => x.Apid)
                .Column("apid")
                .GeneratedBy.Identity();

            Map(x => x.AccountId);

            References(x => x.Permission)    
                .Cascade.None()
                .Fetch.Select()
                .Columns("PermissionId");

        }
    }
}